# -*- coding: utf-8 -*-
"""
Created on 15-12-29 下午12:19
@File: zhihu_login.py
@Author: Liangrong Li
@Contact: liliangrong0@126.com
@Description: 
"""


import urllib2
login_url = 'https://weibo.com'
with open('cookie_weibo.txt','r+') as f:
    cookiestr = f.readlines()
f.closed
headers = {'cookie': cookiestr}
req = urllib2.Request(login_url,headers=headers)
try:
    resp = urllib2.urlopen(req)
    html = resp.read()
    with open('weibo.html','w+') as f:
        f.write(html)
    f.closed
    print u'登陆成功！'
except:
    print u'登录失败！'